document.write("<script type=\"text/javascript\" src=\"../seam/resources/lseam.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"../seam/resources/loginRemote\"></script>");

// 验证登录表单
function checkLoginForm() {
	var loginForm = document.forms[0];
	if(loginForm.loginName.value == "") {
		alert("请输入登录名！");
		loginForm.loginName.focus();
		return false;
	}
	if(loginForm.loginPassword.value == "") {
		alert("请输入密码！");
		loginForm.loginPassword.focus();
		return false;
	}
	return true;
}

// 登录
function doLogin() {
	if(checkLoginForm()) {
		var loginForm = document.forms[0];
		var vo = Lseam.getType("cn.line5.login.LoginVo");
		vo.setLoginName(loginForm.loginName.value);
		vo.setLoginPassword(loginForm.loginPassword.value);
		Lseam.getComponent("loginRemote").login(vo, function(result) {
    		if(result)
    			window.location.href = "main.seam";
    		else {
    			alert("登录名或密码错误，请重新输入！");
    			loginForm.reset();
    		}
    	});
	}
}

// 注销
function loginOut() {
	Lseam.getComponent("loginRemote").loginOut(function(result) {
    		window.location.href = "login.seam";
    	});
}